package vo;

import javax.persistence.*;

@Entity
@NamedQueries({ 
	@NamedQuery(name = "Template.findAll", query = "select e from Template e"), 
	@NamedQuery(name = "Template.findBySourceId", query = "select e from Template e where e.source.id=?"),
	@NamedQuery(name = "Template.findTotalCount", query = "select count(*) from Template t"),
	@NamedQuery(name = "Template.findTotalCountBySourceId", query = "select count(*) from Template t where source.id=?") })
@Table(name = "template")
public class Template extends BaseEntity {

	@Column(name = "name")
	private String name;

	@Column(name = "domain")
	private String domain;

	@Column(name = "url_regex")
	private String urlRegex;

	@Column(name = "fetch_interval")
	private int fetchInterval;

	@JoinColumn(name = "source_id")
	@ManyToOne(fetch = FetchType.LAZY)
	private Source source;

	// @Column(name = "source_id")
	// private long sourceId;

	@Column(name = "content_url_regex")
	private String contentUrlRegex;

	@Column(name = "need_update")
	private int needUpdate;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public String getUrlRegex() {
		return urlRegex;
	}

	public void setUrlRegex(String urlRegex) {
		this.urlRegex = urlRegex;
	}

	public int getFetchInterval() {
		return fetchInterval;
	}

	public void setFetchInterval(int fetchInterval) {
		this.fetchInterval = fetchInterval;
	}

	public Source getSource() {
		return source;
	}

	public void setSource(Source source) {
		this.source = source;
	}

	public String getContentUrlRegex() {
		return contentUrlRegex;
	}

	public void setContentUrlRegex(String contentUrlRegex) {
		this.contentUrlRegex = contentUrlRegex;
	}

	public int getNeedUpdate() {
		return needUpdate;
	}

	public void setNeedUpdate(int needUpdate) {
		this.needUpdate = needUpdate;
	}

}
